package com.example.springmybatisservice.config;

import com.github.pagehelper.PageInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * @author wuxinxin
 */
@Configuration
public class PageHelperConfig {

    @Bean
    PageInterceptor pageInterceptor(){
        PageInterceptor pageInterceptor = new PageInterceptor();
        Properties properties = new Properties();
        properties.setProperty("helperDialect", "mysql");
        //pageSize=0是否查询全部开关
        properties.setProperty("pageSizeZero","true");
        //分页参数合理化开关 pageNum<=0 pageNum>最大页数情况
        properties.setProperty("reasonable","true");
        pageInterceptor.setProperties(properties);
        return pageInterceptor;
    }

}
